import request from '../index';

const baseUrl = '/base-server';
const apiUrl = '/api-server';
const financeUrl = '/finance-server';
const marketingUrl = '/marketing-server';

// 查看个人信息
export const queryLabelByUserId = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/passport/queryLabelByUserId`,
    params: params,
    accountData: accountData,
  });
};
// 查询账户信息
export const getAccount = (params: any, accountData: any, noLoading: boolean = false) => {
  return request({
    url: `${financeUrl}/app/account/getAccount`,
    params: params,
    accountData: accountData,
    noLoading: noLoading,
  });
};

// 查询用等级权益
export const queryUserPrivilege = (params: any, accountData: any) => {
  return request({
    url: `${marketingUrl}/privilege/queryUserPrivilege`,
    params: params,
    accountData: accountData,
  });
};

// 获取未使用的优惠券数量
export const countEntity = (params: any) => {
  return request({
    url: `${marketingUrl}/app/coupon/countEntity`,
    params: params,
  });
};

// 个人信息详情
export const queryPersonal = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/queryPersonal`,
    params: params,
    accountData: accountData,
  });
};

// 编辑个人信息详情
export const updatePersonal = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/updatePersonal`,
    params: params,
    accountData: accountData,
  });
};

// 切换账号
export const switchAccount = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/passport/switchAccount`,
    params: params,
    accountData: accountData,
  });
};

// 退出登录
export const loginOut = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/passport/loginOut`,
    params: params,
    accountData: accountData,
  });
};

// 注销账户
export const passportCancel = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/passport/cancel`,
    params: params,
    accountData: accountData,
    flagRes: true,
    noToast: true,
  });
};

// 查看省市二级级联
export const queryRegionTwoTree = (params: any) => {
  return request({
    url: `${apiUrl}/region/queryRegionTwoTree`,
    params: params,
  });
};

// 查看省市区三级树
export const queryRegionTree = (params: any) => {
  return request({
    url: `${apiUrl}/region/queryRegionTree`,
    params: params,
  });
};

// 分页查询开票订单信息
export const pagingTicketOrder = (params: any, page: any) => {
  return request({
    url: `${financeUrl}/ticket/pagingTicketOrder`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 分页查询开票历史信息
export const pagingTicketRecordHistory = (params: any, page: any) => {
  return request({
    url: `${financeUrl}/ticket/pagingTicketRecordHistory`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 根据发票抬头模糊搜索发票信息
export const queryTicket = (params: any) => {
  return request({
    url: `${financeUrl}/ticket/queryTicket`,
    params: params,
    noLoading: true,
  });
};

// 判断是否显示增值税专用发票
export const queryIsSupportInvoice = (params: any) => {
  return request({
    url: `${baseUrl}/systemSettings/queryIsSupportInvoice`,
    params: params,
    noLoading: true,
  });
};

// 申请开票
export const applyTicket = (params: any, accountData: any) => {
  return request({
    url: `${financeUrl}/ticket/apply`,
    params: params,
    accountData: accountData,
    noLoading: true,
  });
};

// 查询所有车辆
export const queryCarList = (params: any, page: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/queryCarList`,
    params: params,
    extraParams: page,
    accountData: accountData,
    noLoading: true,
  });
};

// 是否支持OCR
export const queryIsSupportOcr = (params: any) => {
  return request({
    url: `${baseUrl}/systemSettings/queryIsSupportOcr`,
    params: params,
  });
};

// 删除汽车
export const deleteCar = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/deleteCar`,
    params: params,
    accountData: accountData,
  });
};

// 添加车辆
export const addCar = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/addCar`,
    params: params,
    accountData: accountData,
  });
};

// 校验车辆重复
export const checkCarRepeat = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/checkCarRepeat`,
    params: params,
    accountData: accountData,
  });
};

// 查询汽车详情
export const queryCarDetail = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/queryCarDetail`,
    params: params,
    accountData: accountData,
  });
};

// 设置默认车辆
export const defaultCar = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/defaultCar`,
    params: params,
    accountData: accountData,
  });
};

// 修改车辆信息
export const updateCar = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/updateCar`,
    params: params,
    accountData: accountData,
  });
};

// 查询soc配置
export const querySocConfig = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/querySocConfig`,
    params: params,
    accountData: accountData,
  });
};

// 修改soc配置
export const updateSocConfig = (params: any, accountData: any) => {
  return request({
    url: `${baseUrl}/personal/updateSocConfig`,
    params: params,
    accountData: accountData,
  });
};

// 获取可退款金额
export const getAvailableRefund = (params: any) => {
  return request({
    url: `${financeUrl}/app/account/getAvailableRefund`,
    params: params,
  });
};

// 分页查询账户流水
export const pagingAccountFlow = (params: any, page: any) => {
  return request({
    url: `${financeUrl}/app/account/pagingAccountFlow`,
    params: params,
    extraParams: page,
    // accountData: accountData,
    noLoading: true,
  });
};

// 微信统一支付
export const unifiedOrder = (params: any) => {
  return request({
    url: `${financeUrl}/app/account/wx/unifiedOrder`,
    params: params,
  });
};
// 校验是否满足参加充值活动的条件
export const checkUnifiedOrder = (params: any) => {
  return request({
    url: `${marketingUrl}/app/userActivity/checkUnifiedOrder`,
    params: params,
  });
};
// 微信退款
export const refundOrder = (params: any) => {
  return request({
    url: `${financeUrl}/app/account/wx/refundOrder`,
    params: params,
  });
};
// 支付前获取openid
export const queryOpenId = (params: any) => {
  return request({
    url: `${baseUrl}/passport/queryOpenIdByCode`,
    params: params,
  });
};
// app跳到微信进行统一支付
export const unifiedAppOrder = (params: any) => {
  return request({
    url: `${financeUrl}/app/account/wx/unifiedAppOrder`,
    params: params,
  });
};

// 分页查询退款申请
export const pagingRefundRequest = (params: any, page: any) => {
  return request({
    url: `${financeUrl}/app/account/pagingRefundRequest`,
    params: params,
    extraParams: page,
    // accountData: accountData,
    noLoading: true,
  });
};

// 获取字典集合
export const queryDicByParent = (params: any) => {
  return request({
    url: `${apiUrl}/dicData/queryDicByParent`,
    params: params,
  });
};

// 分页查询通知
export const pagingNotice = (params: any, page: any) => {
  return request({
    url: `${apiUrl}/noticeApp/pagingNotice`,
    params: params,
    extraParams: page,
    noLoading: true,
  });
};

// 查询通知详情
export const queryAppNotice = (params: any) => {
  return request({
    url: `${apiUrl}/noticeApp/queryAppNotice`,
    params: params,
  });
};

// 查询问题详情
export const questionAppDetail = (params: any) => {
  return request({
    url: `${apiUrl}/questionApp/detail`,
    params: params,
  });
};

// 查询问题 通过分类id 模糊查询
export const questionAppQuestion = (params: any, extraParams?: any) => {
  return request({
    url: `${apiUrl}/questionApp/queryQuestion`,
    params: params,
    extraParams,
    noLoading: true,
  });
};

// 查询所有问题分类 label value
export const queryQuestionClsss = (params: any) => {
  return request({
    url: `${apiUrl}/questionApp/queryQuestionClsss`,
    params: params,
  });
};
